<?php

/**
 * Facebook Plugin
 * A generic Facebook plugin for CakePHP : <http://www.cakephp.org/>
 * 
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright		Copyright (c)	2009, Michael DePuy.
 * @link			http://www.apswerve.com
 * @package			facebook-plugin
 * @license			http://www.opensource.org/licenses/mit-license.php The MIT License
 */

 /**
  * This component is used to modify and record FacebookActions
  */
 class FacebookActionRecorderComponent extends Object {
 	
	/**
	 * Store FacebookActions in the provided $arr.  These actions are stored in the database in the afterFilter() method.
	 * @return void
	 * @param object $arr
	 * @param object $model_name
	 * @param object $user
	 * @param object $friends
	 * @param object $model_id
	 * @param object $action[optional]
	 */
	function recordSentProduct($arr, $model_name, $user, $friends, $model_id, $action='sent') {
		foreach($friends as $friend) {
			
			$new_action['model_name'] = $model_name;
			$new_action['actor'] = $user;
			$new_action['action'] = $action;
			$new_action['model_id'] = $model_id;
			$new_action['target'] = $friend;
			$new_action['t'] = time();
			array_push($arr, $new_action);
			
			return;
			
		}
	}
	
 }
